<?php
	include_once("../model/Acesso.class.php");
	include_once("../model/Mensagem.class.php");
	include_once("../model/Administradora.class.php");
	include_once("../model/Fornecedor.class.php");
	include_once("../model/Produto.class.php");
	$prod = new Produto();
	$acesso = new Acesso();
	$fornecedor = new Fornecedor();
	$codigoPagina = "15";
	if ($acesso->verificaPermissaoUsuario($codigoPagina)){
		$banco = $acesso->getBanco();
	
		$nl = $_GET["n"];
		$cont = 1;	
		echo("<table width=\"100%\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#000000\">");
		while( $cont <= $nl){
						$ns = "produto".$cont;
						$cfop = "cfop".$cont;
						
						$ncm = "ncm".$cont;
						
						$unid= "unid".$cont;
						
						$vu = "valorunit".$cont;
						$qtd = "qtd".$cont;
						$vt= "vt".$cont;
						
                    echo("<tr class=\"letraCampo\">
					  <td width=\"4%\" align=\"center\"> $cont  </td>
                      <td width=\"96%\" align=\"right\">
					  <table width=\"100%\" border=\"0\">
                        <tr class=\"letraCampo\">
                          <td width=\"12%\" align=\"right\">Produto:</td>
                          <td width=\"88%\">
						  	<select name=\"$ns\" class=\"caixaTexto\" id=\"$ns\" onChange=\"inserirdados(this.value,$ncm,$unid)\">
								<option value=\"0\" selected>Selecione um Produto</option>"
						  );
					  	$prods = $prod->getAllProdutos($banco);
						while($temp = mysql_fetch_row($prods)){
							echo("<option value=\"$temp[0]\">$temp[1]</option>");
						}
                    echo("
                          </select></td>
                        </tr>
                      </table>
                        <table width=\"100%\" border=\"0\">
                        <tr class=\"letraCampo\">
						  
                          <td width=\"16%\" align=\"right\">NCM/SH:</td>
                          <td width=\"5%\" align=\"left\"><input name=\"$ncm\" type=\"text\" id=\"$ncm\" size=\"12\" maxlength=\"8\" class=\"caixaTexto\" readonly=\"readonly\"></td>
						  
						   <td width=\"4%\" align=\"right\">Unid:</td>
                          <td width=\"3%\" align=\"left\"><input name=\"$unid\" type=\"text\" id=\"$unid\" size=\"4\" maxlength=\"2\" class=\"caixaTexto\" readonly=\"readonly\"></td>
						  
                          <td width=\"7%\" align=\"right\">CFOP:</td>
                          <td width=\"6%\"><input name=\"$cfop\" type=\"text\" id=\"$cfop\" size=\"8\" maxlength=\"4\" class=\"caixaTexto\" onKeyPress=\"mascara(this, mnum)\"></td>
						  
						  <td width=\"5%\" align=\"right\">Quant:</td>
                          <td width=\"5%\"><input name=\"$qtd\" type=\"text\" id=\"$qtd\" size=\"8\" maxlength=\"8\" class=\"caixaTexto\" value=\"0.00\" onKeyPress=\"mascara(this, mvalor)\" onBlur=\"mult($vu,$qtd,$vt,vte,$nl)\"></td>
						              
						  						  
                          <td width=\"7%\" align=\"right\">Vl Unit: </td>
                          <td width=\"9%\"><input name=\"$vu\" type=\"text\" id=\"$vu\" size=\"12\" maxlength=\"8\" value=\"0.00\" class=\"caixaTexto\" onKeyPress=\"mascara(this, mvalor)\" onBlur=\"mult($vu,$qtd,$vt,vte,$nl)\"></td>
						  
                          <td width=\"8%\" align=\"right\">Vl Total: </td>
                          <td width=\"25%\" align=\"left\"><input name=\"$vt\" type=\"text\" id=\"$vt\" size=\"12\" maxlength=\"8\" class=\"caixaTexto\" readonly=\"readonly\" value=\"0.00\"></td>
						  
                        </tr>
                      </table></td>
                      </tr>"); 
					  $cont = $cont + 1; 
                    } 
                  echo("</table>");
				  
				 
			
		}
?>